/**
 * Created by leo on 2/2.
 */
angular.module('panels')
    .directive('panelItilWorkflowEventSource', function () {
        return {
            scope: {},
            link: function (scope) {
                scope.panelTitle = '事件来源';
                scope.options = {
                    chart: {
                        plotBackgroundColor: null,
                        plotBorderWidth: 0,
                        margin: [0, 0, 0, 0],
                        plotShadow: false
                    },
                    colors: Highcharts.map(Highcharts.getOptions().colors, function (color) {
                        return {
                            radialGradient: {cx: 0.5, cy: 0.3, r: 0.7},
                            stops: [
                                [0, color],
                                [1, Highcharts.Color(color).brighten(-0.1).get('rgb')] // darken
                            ]
                        };
                    }),
                    title: {
                        text: '',
                        align: 'left'
                    },
                    tooltip: {
                        pointFormat: '{series.name}: <b>{point.percentage:.2f}%</b>'
                    },
                    legend: {
                        layout: 'vertical',
                        align: 'left',
                        verticalAlign: 'middle',
                        borderWidth: 0
                    },
                    plotOptions: {
                        pie: {
                            dataLabels: {
                                enabled: true,
                                distance: -28,
                                style: {
                                    //fontWeight: 'bold',
                                    color: 'white',
                                    textShadow: '0px 1px 2px black'
                                }
                            },
                            center: ['65%'],
                            showInLegend: true
                        }
                    },
                    series: [{
                        type: 'pie',
                        name: '工单事件来源',
                        //innerSize: '50%',
                        data: [
                            ['客服', 450],
                            ['告警', 268],
                            ['集团', 128],
                            ['地市', 182]
                        ]
                    }]
                };
            },
            templateUrl: 'app/panel/highcharts-default.html'
        }
    });